<?php 
switch ($id) {
        case  1: $call= 'Januari';break;
        case  2: $call= 'Februari';break;
        case  3: $call= 'Maret';break;
        case  4: $call= 'April';break;
        case  5: $call= 'Mei';break;
        case  6: $call= 'Juni';break;
        case  7: $call= 'Juli';break;
        case  8: $call= 'Agustus';break;
        case  9: $call= 'September';break;
        case 10: $call= 'Oktober';break;
        case 11: $call= 'November';break;
		case 12: $call= 'Desember';break;
    }
?>


<legend>Pembayaran Simpanan Wajib : <b><?php echo $call;?> <?php echo $tahun;?></b></legend>

<script type="text/javascript">
function save(){
	$.ajax({
	type: 'POST',
	url: '<?php echo Yii::app()->createUrl("Tabungan/SaveTabungan"); ?>',
	data:{"data":$.fn.yiiGridView.getChecked("simpanangrid","checkboxes").toString(),"bulan":<?php echo $id; ?>,"tahun":<?php echo $tahun; ?>},
	success:function(data){
								alert("Data Simpanan Wajib bulan <?php echo $call;?> tahun <?php echo $tahun;?> telah disimpan");
								$("#simpanangrid").yiiGridView.update("simpanangrid");
							}
  });	
  
  //console.log($.fn.yiiGridView.getChecked("Anggota","checkboxes").toJSONString());
  // alert($.fn.yiiGridView.getChecked("simpanangrid","checkboxes"));
}
</script>
<!-- search-form -->
<div class="search-form" style="display:none">
<?php $this->renderPartial('_searchAnggota',array(
    'model' => $model,'id'=>$id
)); ?>
</div>
<!-- pagination -->
<?php 
$pageSize=Yii::app()->user->getState('pageSize',Yii::app()->params['defaultPageSize']); 
?>

<?php
$this->widget('zii.widgets.grid.CGridView', array(
    'id' => 'simpanangrid',
    'dataProvider' => $dataProvider,
    //'filter' => $model,
    'columns' => array(
        'NO_ANGGOTA',
        'NAMA', 
		array(
            'class' => 'CCheckBoxColumn',
			'id'=>'checkboxes',
			 'selectableRows' => '2',
			 'header'=>'Selected',
			 'value'=>'1',
			 'checked'=>'true'
        ),
		array(
			'class'=>'CButtonColumn',
			'template'=>'{view}',
			'header'=>CHtml::dropDownList('pageSize',$pageSize,array(20=>20,50=>50,100=>100),
			array(
			// change 'user-grid' to the actual id of your grid!!
			'onchange'=>"$.fn.yiiGridView.update('simpanangrid',{ data:{pageSize: $(this).val() }})",
			)),
		),
    ),
));
?>

<div id="steps">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'anggota-form',
	'enableAjaxValidation'=>false,
	'action'=>Yii::app()->createUrl("Tabungan/SaveTabungan")
)); ?>
<fieldset class="step">
<p class="submit">
		<button id="registerButton" type="button" onclick="save();">Simpan</button>&nbsp;
		<button id="registerButton" type="reset">Reset</button>&nbsp;
		<button id="registerButton" type="button" onclick="window.location.href='<?php echo Yii::app()->createUrl("Tabungan/FormSimpanan");?>'">Kembali</button>
	</p>
	</fieldset>
<?php $this->endWidget(); ?>
</div>